<div class="right-side selection">
    <div class="btn-group">
        <div class="btn-group">
            <a href="<?=base_url().'lists'?>">
                <button type="button" class="btn btn-default">
                    回到列表
                </button></a>
        </div>
        <div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                正在进行
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                <?php
                $i = 0;
                foreach($category as $value) {
                    if ($value['deadline'] - now() > 0) {
                        echo '<li><a href="'.base_url().'lists/search?id='.$value['id'].'">'.$value['category'].'</a></li>';
                        $i++;
                    }
                }
                if ($i == 0)
                    echo '<li><a href="#">暂无</a></li>';
                ?>
            </ul>
        </div>
        <div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                已结束
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                <?php
                $i = 0;
                foreach($category as $value) {
                    if ($value['deadline'] - now() < 0) {
                        echo '<li><a href="'.base_url().'lists/search?id='.$value['id'].'">'.$value['category'].'</a></li>';
                        $i++;
                    }
                }
                if ($i == 0)
                    echo '<li><a href="#">暂无</a></li>';
                ?>
            </ul>
        </div>
    </div>
</div>
<h1 id="titlename"><?=$headline;?></h1>
<div class="clear">
    <div class="col-sm-6 col-md-6">
        <?php
        $having = !empty($query);
        foreach($query as $key => $value) {
            if ($key % 2 == 0)
                echo '<a class="thumbnail" href="'.base_url().'detail?pid='.$value['pid'].'"><img src="'. base_url() . 'uploads/' . $value['filename'] . '" data-src="holder.js/100%x180" /></a>';
        }
        ?>
    </div>
    <div class="col-sm-6 col-md-6">
        <?php
        foreach($query as $key => $value) {
            if ($key % 2 != 0)
                echo '<a class="thumbnail" href="'.base_url().'detail?pid='.$value['pid'].'"><img src="'. base_url() . 'uploads/' . $value['filename'] . '" data-src="holder.js/100%x180" /></a>';
        }
        if (!$having) {
            echo '<div class="clear"><div class="alert alert-danger">目前还没有任何作品的样子</div></div>';
        }
        ?>
    </div>
</div>